import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/generated/l10n.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:finance_app/src/widgets/common/tag_widget.dart';
import 'package:finance_app/src/widgets/select/mixin/radio_mixin.dart';
import 'package:flutter/material.dart';

import 'mixin/check_box_mixin.dart';

class ServiceCheckBox = ServiceRadio with CheckBoxMixin;

class ServiceRadio extends StatelessWidget with RadioMixin {
  final bool isSelect;
  final String title;
  final double minWidth;
  final String sellBuy;
  final bool isActivated;
  final bool isSelectMode;

  const ServiceRadio({
    Key key,
    this.isSelect,
    this.isSelectMode,
    this.title,
    this.minWidth,
    this.isActivated,
    this.sellBuy,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisSize: MainAxisSize.max,
      children: [
        if (isSelectMode == true) ...[
          buildSelectWidget,
          SizedBox(
            width: getDp(24),
          ),
        ],
        Expanded(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisSize: MainAxisSize.min,
            children: [
              Text(
                title,
                style: TextStyle(
                  color: aceBlackColor,
                  fontSize: getSp(16),
                  fontWeight: isSelect || isSelectMode != true
                      ? FontWeight.w700
                      : FontWeight.w400,
                  height: 1,
                ),
              ),
              SizedBox(
                height: getDp(6),
              ),
              Text(
                S.current.sell_buy_sellbuy(sellBuy),
                style: TextStyle(
                  color: aceBlackColor,
                  fontSize: getSp(14),
                  fontWeight: FontWeight.w400,
                  height: 1,
                ),
              )
            ],
          ),
        ),
        if (!isActivated)
          Align(
            alignment: Alignment.topRight,
            child: RedTagWidget(
              content: S.current.deactivated,
            ),
          )
      ],
    );
  }
}
